package io_exercise;

import java.io.*;

public class CopyDemoBuffered2 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis2=new FileInputStream("K.jpg");
        BufferedInputStream bis2=new BufferedInputStream(fis2);
        FileOutputStream fos2=new FileOutputStream("K_cp2.jpg");
        BufferedOutputStream bos2=new BufferedOutputStream(fos2);
        long start2=System.currentTimeMillis();
        int d2;
        while ((d2=bis2.read())!=-1){
            bos2.write(d2);
        }
        long end2=System.currentTimeMillis();
        System.out.println("复制完毕,耗时:"+(end2-start2)+"ms");
        bis2.close();
        bos2.close();
    }
}
